﻿#!/bin/bash

while true; do
    echo "请选择操作:"
    echo "1. up: 启动"
    echo "2. update: 更新"
    echo "3. migrate: 迁移"
    echo "4. down: 停止"
    echo "5. exit: 退出"
    read -p "请输入选项 (1/2/3/4/5): " choice

    case $choice in
        1)
            echo "正在启动服务..."
            docker-compose up -d
            ;;
        2)
            echo "正在更新服务..."
            docker-compose pull && docker-compose up -d
            ;;
        3)
            echo "正在迁移数据库..."
            docker-compose pull migrator && docker-compose run --rm migrator
            ;;
        4)
            echo "正在停止服务..."
            docker-compose down
            ;;
        5)
            echo "退出脚本"
            break
            ;;
        *)
            echo "无效的选择，请重新输入。"
            ;;
    esac
done